package com.pesking.core.sqlparser.processor;

import java.util.Arrays;
import java.util.List;

import com.pesking.core.parameter.Parameter;
import com.pesking.core.sqlparser.parameter.SqlParameter;
import com.pesking.core.sqlparser.parameter.SqlParameterProcessor;
import com.pesking.core.utils.ThisServerUtil;

public class ContextPathParameterSqlHandler extends SqlParameterProcessor {
	@Override
	public String getTitle() {
		return "上下文路径参数";
	}

	@Override
	public String getDescription() {
		return this.getTitle() + " 自动赋值当前上下文路径";
	}

	@Override
	public List<String> getSqlParameterType() {
		return Arrays.asList(new String []{"CONTEXT_PATH"});
	}

    @Override
	public void handle(StringBuilder sbSQL, Parameter parameter,List<SqlParameter> processors,SqlParameter sqlParameter) {
		String cp = ThisServerUtil.getContextPath();
		sbSQL.append("'").append(cp).append("'");
	}

	@Override
	public String getUsage() {
		return "[CONTEXT_PATH]";
	}
}
